{% extends "main.html" %} 
{% block title %}--Edit Post--{{post.title}}{% endblock %}

{% block blog %}
<link rel="stylesheet" type="text/css" href="/static/css/edit.css">
<script type="text/javascript" src="/static/js/edit.js"></script> 
<div class="post">    
    <form id="addblog" onsubmit="return parseBlogContent()" method="post">
      <div id="blogtitle">
         <input id = "title_input" name="title_input" type="text" size="45"
 value="{{post.title}}">
         <label for="title_input"><b>Title</b>(required)</label>
      </div>
      <div id="blogtags">
         <input id="tags" name="tags" type="text" size="45" id="tags" value="{{tags_commas}}">
         <label for="tags"><b>Tags</b>(comma separated without space)</label>
      </div>
      <div id="blogtype">        
         <input type="checkbox" name="private" value="private" {% if post.private %}checked="checked"{%endif%}>
         (private)&nbsp;&nbsp;
         <select name="blogcatalog"> 
         {%for category in categories%}
          <option value="{{category.name}}" {%ifequal post.catalog category.name%}selected="selected"{%endifequal%}>{{category.name|unquote}}</option>
         {%endfor%}            
         </select> 
      </div> 
      <div style="color:#eee">
        <span id="cview">View</span>&nbsp;&nbsp;<span id="ccode"><a href="javascript:void(code())">Code</a></span>                
      </div>
      <div id="blogpost">
        <textarea id="blogpostcode" name="content" style="display:none"></textarea>
        <script>initTool()</script>
        <div id="blogpostview" class="content" contentEditable="true">{{post.content}}</div>
        <div id="status">Status</div>
      </div>
      <div><input id="blogsubmit" type="submit" value="Submit" /></div>
    </form>
</div>
<div id="popDiv" class="mydiv" style="display:none;"><div id="popItem">Welcome!</div><a href="javascript:closeDiv()">Close This</a></div>
<div id="bg" class="bg" style="display:none;"></div>
{% endblock %}
